<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
<<<<<<< HEAD
        alert('hello world')
=======
        var r = ""
        var level = prompt("输入层数：")
        if(isNaN(level))
        {
            console.log("请输入数字！");
        }else{
        level = parseInt(level)
        //金字塔
        for (var j = 1; j <= level; j++) {
            //拼空格
            for(var k=1;k<=level-j;k++)
            {
                r+=" "
            }
            //拼*
            for(var i=1;i<=j*2-1;i++)
            {
                r+="*"
            }

            r += "\n"
        }
        console.log(r);
    }


>>>>>>> b8dfab54d8d6dd07270501e0c9fd5981471c91e7
    </script>
</body>

</html>